package com.huike.report.service.impl;

import com.huike.common.utils.SecurityUtils;
import com.huike.report.domain.vo.IndexVo;
import com.huike.report.mapper.ReportMapper;
import com.huike.report.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IndexServiceImpl implements IndexService {
    @Autowired
    private ReportMapper reportMapper;

    /**
     * 今日简报
     * @param today
     * @return
     */
    @Override
    public IndexVo getTodayInfo(String today) {
        IndexVo todayVo = new IndexVo();
        String username = SecurityUtils.getUsername();
        todayVo.setTodayCluesNum(reportMapper.selectTodayCluesNum(today,username));
        todayVo.setTodayBusinessNum(reportMapper.selectTodayBusinessNum(today,username));
        todayVo.setTodayContractNum(reportMapper.selectTodayContractNum(today,username));
        todayVo.setTodaySalesAmount(reportMapper.selectTodaySalesAmount(today,username));
        return todayVo;
    }

    /**
     * 代办数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @Override
    public IndexVo getTodoInfo(String beginCreateTime, String endCreateTime) {
        IndexVo indexVo = new IndexVo();
        String username = SecurityUtils.getUsername();
        indexVo.setTofollowedCluesNum(reportMapper.selectTofollowedCluesNum(beginCreateTime,endCreateTime,username));
        indexVo.setTofollowedBusinessNum(reportMapper.selectTofollowedBusinessNum(beginCreateTime,endCreateTime,username));
        indexVo.setToallocatedCluesNum(reportMapper.selectToallocatedCluesNum(beginCreateTime,endCreateTime,username));
        indexVo.setToallocatedBusinessNum(reportMapper.selectToallocatedBusinessNum(beginCreateTime,endCreateTime,username));
        return indexVo;
    }
}
